
import { defineStore } from 'pinia'
import state from './state.js'
import actions from './actions'
//导入secure-ls数据加密包
import SecureLS from "secure-ls";
const ls = new SecureLS({
    encodingType: "aes",                  //加密类型
    isCompression: false,                 //是否数据压缩编码
    encryptionSecret: "123456",   //密钥，PBKDF2值，自行设置
});
//定义st对象，该对象包括setItem、getItem、removeItem方法
const st = {
    setItem(key, value) {
        ls.set(key, value)
    },
    getItem(key) {
        return ls.get(key)
    },
    removeItem(key) {
        ls.remove(key)
    }
}

const store = defineStore('userData', {
    state,
    actions,
    persist: { storage: st }
})
export default store
